package chapter14.core;

import java.util.HashMap;
import java.util.Map;


/**
 * info.
 *
 * @author Lingo
 */
public class Info {
    /** success. */
    private boolean success = true;

    /** code. */
    private int code = 0;

    /** msg. */
    private String msg = "操作成功";

    /** info. */
    private Map<String, Object> info = new HashMap<String, Object>();

    /** empty constructor. */
    public Info() {
    }

    /**
     * constructor.
     *
     * @param success boolean
     */
    public Info(boolean success) {
        this.success = success;
    }

    /**
     * constructor.
     *
     * @param msg String
     */
    public Info(String msg) {
        this.msg = msg;
    }

    /**
     * constructor.
     *
     * @param success boolean
     * @param msg String
     */
    public Info(boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }

    /**
     * constructor.
     *
     * @param success boolean
     * @param code int
     * @param msg String
     */
    public Info(boolean success, int code, String msg) {
        this.success = success;
        this.code = code;
        this.msg = msg;
    }

    /** @return success. */
    public boolean isSuccess() {
        return success;
    }

    /** @return code. */
    public int getCode() {
        return code;
    }

    /** @return msg. */
    public String getMsg() {
        return msg;
    }

    /** @return map. */
    public Map<String, Object> getInfo() {
        return info;
    }

    /**
     * put value in map.
     *
     * @param name String
     * @param value Object
     */
    public void put(String name, Object value) {
        info.put(name, value);
    }
}
